#ifndef FUNCTION_H
#define FUNCTION_H
#include <iostream>
#include <vector>
#include <cmath>
#include <functional>



class Function_One_Dimension
{
public:
    virtual double operator()(double x) const = 0;
    virtual double derivative(double x) const
    {
        const double h = 1e-5;
        return ((*this)(x + h) - (*this)(x - h)) / (2 * h);
    }
    virtual ~Function_One_Dimension() = default;
};


class Function_Two_Dimension
{
public:
    virtual double operator()(double x, double y) const = 0;
    virtual double derivative_x(double x, double y) const
    {
        const double h = 1e-5;
        return ((*this)(x + h, y) - (*this)(x - h, y)) / (2 * h);
    }
    virtual double derivative_y(double x, double y) const
    {
        const double h = 1e-5;
        return ((*this)(x, y + h) - (*this)(x, y - h)) / (2 * h);
    }
    virtual ~Function_Two_Dimension() = default;
};



#endif // FUNCTION_H



